package test00.lx04.t03;

import test00.lx04.t01.Student;

import java.util.Arrays;

/**
 * @author ZQX
 * @date 2025-04-07
 */
public class MainTest {
    public static void main(String[] args) {
        Student[] arrStudents = {
                new Student("张三", 18),
                new Student("李四", 8),
                new Student("王五", 38),
                new Student("赵六", 28),
                new Student("田七", 7),
        };

        // int compare(T o1, T o2);
        Arrays.sort(arrStudents, (o1, o2) -> o2.getAge() - o1.getAge());
        // Arrays.sort(arrStudents, Comparator.comparingInt(Student::getAge));

        for (Student stu : arrStudents) {
            System.out.println(stu);
        }
    }
}
